const Redis = require('ioredis')
const { 
  REDIS_HOST,
  REDIS_PORT,
  REDIS_PASSWORD,
  REDIS_DB
} = process.env

const redisClient = new Redis({
  port: REDIS_PORT, // Redis port
  host: REDIS_HOST, // Redis host
//   username: 'default', // needs Redis >= 6
  password: REDIS_PASSWORD,
  db: REDIS_DB, // Defaults to 0
})

module.exports = redisClient
